package com.example.demo8.controller;

import com.example.demo8.service.ChatService;
import com.example.demo8.util.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ChatController {

    @Resource
    private ChatService chatService;

    @GetMapping("/list")
    public Result list(@RequestParam("fromUser") String from,
                       @RequestParam("toUser") String to) {
        return Result.ok(chatService.listByFromAndTo(from, to));
    }
}
